package com.aaa.mrcai.service.impl;

import com.aaa.mrcai.mapper.IndexMapper;
import com.aaa.mrcai.pojo.entity.StoreGoods;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TODO
 *
 * @author 惠普
 * @date 2021/12/13  10:18
 */
@Service
public class IndexServiceImpl implements IndexService {

    @Autowired
    private IndexMapper indexMapper;


    @Override
    public AjaxResult seaGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.seaGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult fruitGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.fruitGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult greensGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.greensGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult oilGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.oilGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult eggGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.eggGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult driedGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.driedGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult meatGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.meatGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }

    @Override
    public AjaxResult nativeGoodsList() {
        List<StoreGoods> storeGoods = indexMapper.nativeGoodsList();
        if(storeGoods.size()>0){
            return AjaxResult.success(storeGoods);
        }else {
            return AjaxResult.defeated();
        }
    }
}
